package com.project.bookstore.exception;

import com.project.bookstore.common.State;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("业务错误类")
public class ServiceException extends RuntimeException{
    @ApiModelProperty("错误代码")
    Integer state;
    @ApiModelProperty("错误信息")
    String message;

    public ServiceException(State state, String message){
        this.state = state.getState();
        this.message = message;
    }
}
